import { http } from '@/utils/http'
import type { FormQueryData } from './types'

const PATH = '/dept'

const DeptAPI = {
  /** 获取列表 */
  getList() {
    return http.request<ResponseData>('get', `${PATH}`)
  },
  /** 创建 */
  create(data: FormQueryData) {
    return http.request<ResponseData>('post', `${PATH}`, { data })
  },
  /** 修改 */
  update(id: number, data: FormQueryData) {
    return http.request<ResponseData>('put', `${PATH}/${id}`, { data })
  },
  /** 单选删除 */
  delete(id: number) {
    return http.request<ResponseData>('delete', `${PATH}/${id}`)
  }
}

export default DeptAPI
